﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserBillManage.aspx.cs" Inherits="Admin_UserBillManage" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>无标题页</title>
    <link href="../css/main-admin.css" rel="stylesheet" type="text/css" />

    <script src="../Jscript/jquery-1.3.2.min.js" type="text/javascript"></script>

    <script src="../Jscript/page.js" type="text/javascript"></script>

    <script src="../Jscript/SepSet.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(document).ready(function() {


            $(".trans-search-sep").hide();
            var h = $(document).height();
            window.parent.document.getElementById("mainshow").style.height = h + "px";


        });

        function ToCk(no) {


            if ($("#div" + no).css("display") == "none") {

                //   $(".trans-search-sep").hide();


                //  $(".iamgeclass").attr("src", "../images/arr-down-s.gif");

                $("#Imag" + no).attr("src", "../images/arr-up-s.gif");
                $("#div" + no).show();
                var h = $(document).height();

                window.parent.document.getElementById("mainshow").style.height = h + "px";
            }
            else {

                var h = $("#div" + no).height();

                $("#Imag" + no).attr("src", "../images/arr-down-s.gif");

                $("#div" + no).hide();


                var lh = $(document).height() - h;

                window.parent.document.getElementById("mainshow").style.height = lh + "px";

            }
        }

        function Ckbox(no) {


            if ($("#ckb" + no).attr("checked") == true) {

                $("#div" + no + " input").attr("checked", true);
            }


        }
        var selectalltg = false;
        function selectall() {

            if (selectalltg == false) {
                selectalltg = true;
                $("input[ type='checkbox']").attr("checked", true);

            }
            else {
                selectalltg = false;
                $("input[ type='checkbox']").attr("checked", false);

            }
        }

        function EditValue(tp) {

            var tnvalue = '';
            $("input[type=checkbox]").each(function() {

                if ($(this).attr("checked") == true) {

                    tnvalue = tnvalue + "," + $(this).val();
                }
            });
            if (tnvalue == "") {
                alert("你并未选择到有单据");
            }
            else {

                switch (tp) {
                    case "name":
                        window.location = "NameEdte.aspx?no=" + tnvalue;
                        break;
                    case "logo":
                        window.location = "BillLogoPl.aspx?no=" + tnvalue;
                        break;
                    case "other":
                        window.location = "OtherEdit.aspx?no=" + tnvalue;
                        break;
                    case "price":
                        window.location = "PriceEdit.aspx?no=" + tnvalue;
                        break

                    case "toexcel":
                        window.location = "BillToExcel.aspx?no=" + tnvalue;
                        break;

                    case "print":
                        window.location = "ToPdf.aspx?no=" + tnvalue;
                        break;


                    case "del":
//                        var Tno = "";
//                        var ok = true;
//                        $("input[type=checkbox]").each(function() {

//                            if ($(this).attr("checked") == true) {

//                                var no = $(this).attr("title");

//                                if (no.indexOf("SepNo") == 0) {

//                                    var tnp = $(this).attr("id").replace("sep", "");

//                                    var notchose = 0;
//                                    $("#div" + tnp + "  input[type=checkbox]  ").each(function() {
//                                        if ($(this).attr("checked") == false) {

//                                            notchose = notchose + 1;
//                                        }

//                                    });

//                                    if (notchose == 1) {
//                                        ok = false;
//                                        if (Tno.indexOf(tnp) == -1) {
//                                            Tno += "," + tnp;
//                                        }
//                                    }
//                                }

//                            }
//                        });


//                        if (!ok) {
//                            OpenWindow("以下单据您还有1张分单未删除，当前设置不允许如此选择：<br/>" + Tno);
//                            return;
//                        }
                        OpenWindow("单据删除中.....请勿关闭！");
                        $.post("DelBill.ashx", { Tno: tnvalue }, function(data) {

                            if (data == "ok") {

                                OpenWindow("单据删除成功!页面将刷新");
                                location.reload();
                            }
                            else {

                                OpenWindow(data);
                            }

                        });

                        break;

                }
            }

        }
 
    </script>

</head>
<body>

    <script type="text/javascript" src="../DatePicker/WdatePicker.js"></script>

    <form id="form1" runat="server">
    <div class="title">
        用户资料 &nbsp;<asp:Label ID="anolb" runat="server"></asp:Label>&nbsp;<asp:Label ID="namelb"
            runat="server"></asp:Label>&nbsp;
    </div>
    <div style="color: #606; font-weight: bold; float: left; width: 966px; padding-bottom: 20px">
        <a href='UserEditAll.aspx?id=<%=Request.QueryString["id"].ToString()%>&ano=<%=Request.QueryString["ano"].ToString()%>&name=<%=Request.QueryString["name"].ToString()%>'"'
            class="user-detail-menu">基本资料</a> <a href='UserBillManage.aspx?id=<%=Request.QueryString["id"].ToString()%>&ano=<%=Request.QueryString["ano"].ToString()%>&name=<%=Request.QueryString["name"].ToString()%>'
                class="user-detail-menu-active">历史运单</a> <a href='UserPayHist.aspx?id=<%=Request.QueryString["id"].ToString()%>&ano=<%=Request.QueryString["ano"].ToString()%>&name=<%=Request.QueryString["name"].ToString()%>'"'
                    class="user-detail-menu">付款历史</a> <a href='UserStateMent.aspx?id=<%=Request.QueryString["id"].ToString()%>&ano=<%=Request.QueryString["ano"].ToString()%>&name=<%=Request.QueryString["name"].ToString()%>'"'
                        class="user-detail-menu">月结报表</a> <a href='UserCalulate.aspx?id=<%=Request.QueryString["id"].ToString()%>&ano=<%=Request.QueryString["ano"].ToString()%>&name=<%=Request.QueryString["name"].ToString()%>'"'
                            class="user-detail-menu">运费结算</a>
    </div>
    <div style="color: #636; margin-bottom: 25px;">
        货物单号
        <input type="text" name="textfield" id="stno" runat="server" style="width: 70px;
            border: 1px solid #CCC; height: 15px; margin-right: 10px;" />
        分单号
        <input type="text" name="textfield" id="sepno" runat="server" style="width: 50px;
            border: 1px solid #CCC; height: 15px; margin-right: 10px;" />
        参考号
        <input type="text" name="textfield" id="zzhtxt" runat="server" style="width: 50px;
            border: 1px solid #CCC; height: 15px; margin-right: 10px;" />
        寄件人
        <input type="text" name="textfield" id="accnotxt" runat="server" style="width: 40px;
            border: 1px solid #CCC; height: 15px; margin-right: 10px;" />
        收件人
        <input type="text" name="textfield" id="recervertxt" runat="server" style="width: 40px;
            border: 1px solid #CCC; height: 15px; margin-right: 10px;" />
        货物状态
        <asp:DropDownList ID="statetxt" runat="server" Width="80px">
        </asp:DropDownList>
        <%--        <select name="select" id="statetxt" runat="server" style="width: 90px; border: 1px solid #CCC; height: 20px;
            margin-right: 10px;">
            <option selected="selected">所有状态</option>
            <option>等待处理</option>
            <option>接受处理</option>
            <option>离开仓库</option>
            <option>飞行中</option>
            <option>清关中</option>
            <option>海关检查</option>
            <option>国内转运中</option>
            <option>已签收</option>
        </select>--%>
        制单时间
        <input type="text" name="textfield" id="startime" runat="server" onfocus="WdatePicker({skin:'blue'})"
            style="width: 65px; border: 1px solid #CCC; height: 15px;" />
        至
        <input type="text" name="textfield" id="endtime" runat="server" onfocus="WdatePicker({skin:'blue'})"
            style="width: 65px; border: 1px solid #CCC; height: 15px; margin-right: 10px;" />
        <asp:ImageButton ImageAlign="AbsMiddle" ImageUrl="~/images/btn-search.gif" ID="sercherbtn"
            Width="68" Height="20" OnClick="searchbtn_Click" runat="server" />
    </div>
    <div class="trans-search-title">
        <div class="trans-search-selall">
            <b onclick="selectall()" style="cursor: pointer">全选</b></div>
        <div class="trans-search-arr">
            &nbsp;</div>
        <div class="trans-search-no">
            货运单号</div>
        <div class="trans-search-status">
            货运状态</div>
        <div class="trans-search-sender">
            寄件人</div>
        <div class="trans-search-rec">
            收件人</div>
        <div class="trans-search-case">
            件数</div>
        <div class="trans-search-wt">
            磅</div>
        <div class="trans-search-ref">
            参考号</div>
        <div class="trans-search-type">
            运单类型</div>
        <div class="trans-search-price">
            价格</div>
        <div class="trans-search-date">
            制单时间</div>
    </div>
    <asp:Repeater ID="billlist" runat="server">
        <ItemTemplate>
            <%# ((Container.ItemIndex + 1) % 2) == 0 ? "<div    class='trans-search-line result-bg'>" : "<div    class='trans-search-line'>"%>
            <div class="trans-search-selall">
                <input type="checkbox" name="checkbox" id='ckb<%#Eval("TrackingNo")%>' onclick='Ckbox(<%#Eval("TrackingNo")%>)'
                    value='<%#Eval("TrackingNo")%>Num<%#Eval("Sep").ToString()=="1"?Eval("NoOfPiece").ToString():"0"%>'
                    title='<%#Eval("TrackingNo")%>' /></div>
            <div class="trans-search-arr mtop3">
                <%# Eval("sep").ToString() == "0" ? "" : "   &nbsp;<img class='iamgeclass'  src='../images/arr-down-s.gif' id=\"Imag" + Eval("TrackingNo").ToString() + "\" width='13' height='13' onclick=\"ToCk('" + Eval("TrackingNo").ToString() + "')\"  />"%>
            </div>
            <div class="trans-search-no mtop3">
                <a href='BillShow.aspx?tno=<%#Eval("TrackingNo")%>'>
                    <%#Eval("TrackingNo")%></a></div>
            <div class="trans-search-status mtop3" title='<%#Eval("UPEXState")%>'>
                <%#  Ysb.Components.StrHelper.GetSubString(Eval("UPEXState").ToString(),5)%>
            </div>
            <div class="trans-search-sender mtop3" titil=' <%#Eval("Sender")%>'>
                <%#Ysb.Components.StrHelper.GetSubString(Eval("Sender").ToString(),4)%>
            </div>
            <div class="trans-search-rec mtop3" titil=' <%#Eval("Receiver")%>'>
                <%#Ysb.Components.StrHelper.GetSubString(Eval("Receiver").ToString(), 4)%>
            </div>
            <div class="trans-search-case mtop3">
                <%#Eval("NoOfPiece")%></div>
            <div class="trans-search-wt mtop3">
                <%# Eval("sep").ToString() == "0" ? Eval("ChargedWt").ToString() : Eval("SepChargedWt").ToString()%>
            </div>
            <div class="trans-search-ref mtop3">
                <%#Eval("FlightNo")%></div>
            <div class="trans-search-type mtop3">
                <%#new BLL.WayBillService().GetCalTypeName(Eval("Memo1").ToString())%></div>
            <div class="trans-search-price mtop3">
                <%# Eval("sep").ToString() == "0" ? Eval("Total").ToString() : Eval("SepTotal").ToString()%>
            </div>
            <div class="trans-search-date mtop3">
                <%# Convert.ToDateTime(Eval("CreateDate").ToString()).ToShortDateString()%></div>
            <div class="trans-search-reuse mtop3">
                <a href='BillEdit.aspx?area=cy&tno=<%#Eval("TrackingNo") %>'>重用</a></div>
            <div class="trans-search-track mtop3">
                <a href='zhuizong.aspx?id=<%#Eval("TrackingNo") %>'>跟踪</a></div>
            <div class="trans-search-print mtop3">
                <a href='ToPdf.aspx?no=<%#Eval("TrackingNo") %>&&sep=false'>打印</a></div>
            <div class="trans-search-addsep mtop3">
                <a href="#" onclick="ToSetSep('<%#Eval("TrackingNo")%>')">添加分单</a></div>
            </div>
            <div class="trans-search-sep" id='div<%#Eval("TrackingNo").ToString()%>'>
                <asp:Repeater ID="sep_list" runat="server" DataSource='<%#getrpro( Eval("TrackingNo").ToString()) %>'>
                    <ItemTemplate>
                        <div class="trans-search-line">
                            <div class="trans-search-selall">
                                <input type="checkbox" name="checkbox" id='sep<%#Eval("TrackingNo").ToString()%>'
                                    value='SepNo<%#Eval("SepNo")%>Tno<%#Eval("TrackingNo").ToString()%>' title='SepNo<%#Eval("SepNo")%>'
                                    onclick='Sepck()' /></div>
                            <div class="trans-search-arr mtop3">
                                &nbsp;</div>
                            <div class="trans-search-no mtop3">
                                <a href='BillSepEdit.aspx?SepNo=<%#Eval("SepNo")%>'>
                                    <%#Eval("SepNo")%></a></div>
                            <div class="trans-search-status mtop3">
                                <%#  Ysb.Components.StrHelper.GetSubString(Eval("SBState").ToString(), 5)%>
                            </div>
                            <div class="trans-search-sender mtop3">
                                <%#Ysb.Components.StrHelper.GetSubString(Eval("SendBy").ToString(), 4)%>
                            </div>
                            <div class="trans-search-rec mtop3">
                                <%#Ysb.Components.StrHelper.GetSubString(Eval("CHNReceiver").ToString(), 4)%>
                            </div>
                            <div class="trans-search-case mtop3">
                                <%#Eval("Pieces")%></div>
                            <div class="trans-search-wt mtop3">
                                <%#Eval("ChargedWt")%></div>
                            <div class="trans-search-ref mtop3">
                                <%#Eval("FlightNo")%></div>
                            <div class="trans-search-type mtop3">
                                <%#new BLL.WayBillService().GetCalTypeName(Eval("Memo1").ToString())%></div>
                            <div class="trans-search-price mtop3">
                                <%# Eval("Total")%></div>
                            <div class="trans-search-date mtop3">
                                <%#Convert.ToDateTime( Eval("CreateDate").ToString()).ToShortDateString()%></div>
                            <div class="trans-search-reuse mtop3">
                                &nbsp;</div>
                            <div class="trans-search-track mtop3">
                                <a href='Zhuizong.aspx?id=<%#Eval("SepNo") %>'>跟踪</a></div>
                            <div class="trans-search-seplogo mtop3">
                                <img src='../UpLoad/small/small<%#Eval("Logo") %>' width="53" height="13" />
                            </div>
                        </div>
                    </ItemTemplate>
                </asp:Repeater>
            </div>
        </ItemTemplate>
    </asp:Repeater>
    <div style="margin: 10px 0px 0px 3px;">
        <img src="../images/arrow-up.gif" width="25" height="24" />
        &nbsp;
        <img src="../images/btn-deletelot.gif" width="68" height="25" onclick="EditValue('del')" />
        &nbsp;
        <img src="../images/btn-printlot.gif" width="68" height="25" onclick="EditValue('print')" />
        &nbsp;
        <img src="../images/btn-itemlot.gif" width="68" height="25" border="0" onclick="EditValue('name')" />
        &nbsp;
        <img src="../images/btn-pricelot.gif" width="68" height="25" border="0" onclick="EditValue('price')" />
        &nbsp;
        <img src="../images/btn-otherlot.gif" width="68" height="25" border="0" onclick="EditValue('other')" />
        &nbsp;
        <img src="../images/btn-pringlogolot.gif" width="68" height="25" border="0" onclick="EditValue('logo')" />
    </div>
    <div class="trans-export">
    </div>
    <div class="trans-nav" style="margin-top: 10px; text-align: center">
        <webdiyer:AspNetPager ID="NewsPage" runat="server" AlwaysShow="True" CustomInfoHTML="第%CurrentPageIndex%页，共%PageCount%页，每页%PageSize%条"
            OnPageChanged="NewsPage_PageChanged" PageIndexBoxType="TextBox" ShowPageIndexBox="Always"
            SubmitButtonText="" TextAfterPageIndexBox="" TextBeforePageIndexBox="跳页" Width="800px"
            FirstPageText="&lt;img src=&quot;../img/btn-first.jpg&quot; width=&quot;46&quot; height=&quot;21&quot; align=&quot;absmiddle&quot; /&gt;"
            LastPageText="&lt;img src=&quot;../img/btn-last.jpg&quot; width=&quot;46&quot; height=&quot;21&quot; align=&quot;absmiddle&quot; /&gt;"
            NextPageText="&lt;img src=&quot;../img/btn-next.jpg&quot; width=&quot;32&quot; height=&quot;21&quot; align=&quot;absmiddle&quot; /&gt;"
            PrevPageText="&lt;img src=&quot;../img/btn-prev.jpg&quot; width=&quot;32&quot; height=&quot;21&quot; align=&quot;absmiddle&quot; /&gt;"
            SubmitButtonClass="showsb" PageIndexBoxClass="pageindexbox" PageSize="20">
        </webdiyer:AspNetPager>
    </div>
    </form>
</body>
</html>
